package controllers

import (
	beego "github.com/beego/beego/v2/server/web"
	"net"
	"ocane/models"
)
type ClassController struct {
	beego.Controller
}
type SocketController struct {
	beego.Controller
}

func (this *ClassController) Get() {
	getInt, _ := this.GetInt("id")
	userId, _ := this.GetInt("userId")
	job := models.GoJob{Id: getInt, Name: "job1", UserId: userId}
	class := models.AddClass(job)
	this.Data["json"] = class
	this.ServeJSON()
}

func (this *SocketController) Get(){
	listen, err := net.Listen("tcp", "localhost:3986")
	if err!=nil{
		panic(err)
	}
	accept, _ := listen.Accept()
	accept.Write([]byte("hello"))
}

